<?php
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

if (!function_exists('mengapa1')) {
    function mengapa1($value = '') {
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = 1';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}

if (!function_exists('mengapa2')) {
    function mengapa2($value = '') {
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = 2';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}

if (!function_exists('mengapa3')) {
    function mengapa3($value = '') {
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = 3';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}

if (!function_exists('quickquiz')) {
    function quickquiz($value = '') {
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = 4';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}

if (!function_exists('lessonsplan')) {
    function lessonsplan($value = '') {
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = 5';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}

//Function memanggil konten statis
if (!function_exists('konten_statis')) {
    function konten_statis($id_konten = '',$value = '') {
        //$id_konten = id_konten yang dipanggil
        //$value = field table konten_statis yang dipanggil
        $CI = & get_instance();
        $CI->load->database();
        
        $sql = 'SELECT '.$value.' FROM konten_statis WHERE id_konten_statis = '.$id_konten.'';
        $CI->db->cache_on();
        $query = $CI->db->query($sql);
        if ($query->num_rows() > 0) {
            $result = $query->row_array();            
            $query->free_result();
        } else {
            $result = array();
        }

        $value = $result[$value];
        return $value;
    }
}